[IA64] linux: grant table hypercall work around
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Tue, 9 May 2006 17:41:06 +0000 (11:41 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Tue, 9 May 2006 17:41:06 +0000 (11:41 -0600)
Current xen/ia64 grant table ignores some GNTMAP_xxx flags.
work around for that. This patch will be removed once the flags are supported.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h

index 306027c89f432e8856234910847a040f17802c3d..91b3bf39b7b3bbfe20c2aab9d5d97efa1fe2f533 100644 (file)
@@ -200,6 +200,59 @@ out:
 }
 
 
+///////////////////////////////////////////////////////////////////////////
+// grant table hack
+// cmd: GNTTABOP_xxx
+
+#include <linux/mm.h>
+#include <xen/interface/xen.h>
+#include <xen/gnttab.h>
+
+static void
+gnttab_map_grant_ref_pre(struct gnttab_map_grant_ref *uop)
+{
+       uint32_t flags;
+
+       flags = uop->flags;
+       if (flags & GNTMAP_readonly) {
+#if 0
+               xprintd("GNTMAP_readonly is not supported yet\n");
+#endif
+               flags &= ~GNTMAP_readonly;
+       }
+
+       if (flags & GNTMAP_host_map) {
+               if (flags & GNTMAP_application_map) {
+                       xprintd("GNTMAP_application_map is not supported yet: flags 0x%x\n", flags);
+                       BUG();
+               }
+               if (flags & GNTMAP_contains_pte) {
+                       xprintd("GNTMAP_contains_pte is not supported yet flags 0x%x\n", flags);
+                       BUG();
+               }
+       } else if (flags & GNTMAP_device_map) {
+               xprintd("GNTMAP_device_map is not supported yet 0x%x\n", flags);
+               BUG();//XXX not yet. actually this flag is not used.
+       } else {
+               BUG();
+       }
+}
+
+int
+HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
+{
+       if (cmd == GNTTABOP_map_grant_ref) {
+               unsigned int i;
+               for (i = 0; i < count; i++) {
+                       gnttab_map_grant_ref_pre(
+                               (struct gnttab_map_grant_ref*)uop + i);
+               }
+       }
+
+       return ____HYPERVISOR_grant_table_op(cmd, uop, count);
+}
+
+
 ///////////////////////////////////////////////////////////////////////////
 //XXX taken from balloon.c
 //    temporal hack until balloon driver support.
index c30d5c0d10d10d0ebc07eadb4f17aab79583202a..d81e4d1598b3db45a80bb6d3a02f1da686e2aa4d 100644 (file)
@@ -244,12 +244,19 @@ HYPERVISOR_physdev_op(
     return rc;
 }
 
+//XXX __HYPERVISOR_grant_table_op is used for this hypercall constant.
 static inline int
-HYPERVISOR_grant_table_op(
+____HYPERVISOR_grant_table_op(
     unsigned int cmd, void *uop, unsigned int count)
 {
     return _hypercall3(int, grant_table_op, cmd, uop, count);
 }
+#ifndef CONFIG_XEN_IA64_DOM0_VP
+#define HYPERVISOR_grant_table_op(cmd, uop, count) \
+       ____HYPERVISOR_grant_table_op((cmd), (uop), (count))
+#else
+int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
+#endif
 
 static inline int
 HYPERVISOR_vcpu_op(